package net.dengzixu.java.homework.period24;

/**
 * @author Deng Zixu <admin@dengzixu.com>
 */
public class Test {
    public static void main(String[] args) {
        Balloon balloon = new Balloon();
        Locust locust = new Locust();

        testFly(balloon);
        testFly(locust);
    }

    private static void testFly(Fly fly) {
        fly.fly();
    }
}

interface Fly {
    void fly();
}

interface Jump {
    void jump();
}

class Balloon implements Fly {
    @Override
    public void fly() {
        System.out.println("Balloon can fly.");
    }
}

class Locust implements Fly, Jump {
    @Override
    public void fly() {
        System.out.println("Locust can fly.");
    }

    @Override
    public void jump() {
        System.out.println("Locust can jump.");
    }
}
